#include <iostream>
#define N 100

using namespace std;

void printintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}

void read_asc(int array[],int elements){
int i, k, j;
int number;

for(i=0;i<elements;i++)
	array[i]=0;
for (i=0;i<elements;i++){
	cout<<"a["<<i<<"]=";
	cin>>number;
	j=elements-1;
	while (j>-1 && number<array[j])
		--j;
		k=0;
	while (k<j){
		array[k]=array[k+1];
		++k;}
	array[j]=number;
		}

}

int main(){
int array[N];
int elements;
cout<<"Type the number of elements you want in the array: ";
cin>>elements;

read_asc(array, elements);

cout<<"The ascending sorted array is : ";
printintVector(array, elements);

return 0;
}
